package com.hzit.loan.pay.commonApi.enums;

/**
 * 支付通知状态枚举
 */
public enum NotifyResultEnum {


    NOTIFY_FAIL("-1","通知失败"),
    NOTIFY_SUCCESS("0","通知成功"),
    NOTIFY_ING("1","通知中");


    private String code;

    private String desc;

    NotifyResultEnum(String code,String desc){

        this.code = code;
        this.desc = desc;

    }

    /**
     * 根据desc获取code
     * @param desc
     * @return
     */
    public String getCode(String desc){

        for ( NotifyResultEnum notifyResultEnum :NotifyResultEnum.values()){

            if(desc.equals(notifyResultEnum.getDesc())){
                return notifyResultEnum.getCode();
            }
        }

        return null;
    }

    /**
     * 根据code获取desc
     * @param code
     * @return
     */
    public String getDesc(String code){

        for ( NotifyResultEnum notifyResultEnum :NotifyResultEnum.values()){

            if(code.equals(notifyResultEnum.getCode())){
                return notifyResultEnum.getDesc();
            }
        }

        return null;
    }




    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }
}
